import Vue from 'vue'
import 'static/config.js'
import App from './App'
import "babel-polyfill";
import {appRouter} from './router/router'
import router from './router/index';
import store from './store'
import iView from 'iview';
import 'iview/dist/styles/iview.css';    // 使用 CSS
import axios from '@/common/axios.js';
import common from '@/common/common.js';
import dateutil from '@/common/dateutil.js';

Vue.use(iView);
Vue.prototype.$http = axios;
Vue.prototype.common = common;
Vue.prototype.dateutil = dateutil;

new Vue({
    el: '#app',
    router,
    store,
    render: h => h(App),
    mounted () {
        // 显示打开的页面的列表
        this.$store.commit('setOpenedList');
        // // 权限菜单过滤相关
        this.$store.commit('updateMenulist');
    },
    created () {
        let tagsList = [];
        appRouter.map(item => {
            if (item.children.length <= 1) {
                tagsList.push(item.children[0]);
            } else {
                tagsList.push(...item.children);
            }
        });
        this.$store.commit('setTagsList', tagsList);
    }
});
